package NGUYENVANDOAN.EXAM01.BAITOAN02;

public class StudentController implements IMICInterface {
    @Override
    public String PrintStudentInfo(Object obj) {
        Students objStudent = (Students)obj;
        String str = objStudent.isSex() ? "male" : "female";
        return "My fullname is: " + objStudent.getFullName() + 
                        " \nhas rollno: " + objStudent.getRollNo() + 
                        " \nsex is: " + str + 
                        " \nemail: " + objStudent.getEmail() + 
                        " \nmobile: " + objStudent.getMobile() + 
                        " \naddress: " + objStudent.getAddress() + 
                        " \nMark: " + objStudent.getMark();
    }

    @Override
    public String CheckMarks(Object obj) {
        Students objStudent = (Students)obj;
        if (objStudent.getMark() >= 9) {
            return "Đạt loại giỏi";
        } else if (objStudent.getMark() >= 7.5 
                                && objStudent.getMark() < 9) {
            return "Đạt loại khá";
        } else if (objStudent.getMark() >= 5.0 
                                && objStudent.getMark() < 7.0) {
            return "Đạt loại trung bình";
        } else {
            return "Đạt loại kém";
        }
    }

    @Override
    public boolean CompareTo(Object objA, Object objB) {
        Students objStudentA = (Students)objA;
        Students objStudentB = (Students)objB;
        return (objStudentA.getMark() == 
                                objStudentB.getMark()) ? true : false;
    }
}
